package com.green.cloud.server.api;

import com.green.cloud.server.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("hello-service")
@RequestMapping("/server/hello")
public interface HelloService {

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    User add(@RequestBody User user);

    @RequestMapping(value = "/user", method = RequestMethod.GET)
    User user(@RequestParam("id") Long id);

    @RequestMapping(value = "/redis/get", method = RequestMethod.GET)
    String redisGet(@RequestParam("key") String key);

    @RequestMapping(value = "/mongo/add", method = RequestMethod.POST)
    User mongoAdd(@RequestBody User user);

    @RequestMapping(value = "/mongo/get", method = RequestMethod.GET)
    List<User> mongoGet();
}
